<!--开户单位全面流动性查询申请录入页面-->
<template>
  <div class="app-container">
    <div style="width: 1024px;margin: 20px auto">
      <ht-table
        ref="dataTable"
        :showSerialNumber="false"
        :multi-select="false"
        :dictMap="dictMap"
        :reqConfig="reqConfig"
        :queryParams="queryParams"
        :tableBindColumns="tableBindColumns"
        :opButtonList="opButtonList"
      ></ht-table>
      <el-form
        ref="entryForm"
        :model="formData"
        :rules="rules"
        label-width="126px"
        style="margin-top: 50px"
      >
        <el-row v-if="this.formData.rspId">
          <el-col :span="24">
            <el-form-item label="交易流水号" prop="rspId">
              <el-input v-model="formData.rspId" disabled/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="查询方式：" prop="inqType">
              <el-select
                v-model="formData.inqType"
                placeholder="请选择"
                style="width: 235px;"
                :disabled="isforbid"
              >
                <el-option
                  v-for="dict in dictMap.CLS_QUERYTYPE"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item label="备注：" prop="remarks">
              <el-input
                type="textarea"
                v-model="formData.remarks"
                show-word-limit
                maxlength="256"
                :disabled="isforbid"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div class="bottom-control">
        <el-button
          type="primary"
          @click="submitFn"
          :loading="isLoading"
          v-if="!this.formData.rspId"
        >提交</el-button>
        <el-button type="warning" @click="resetFn">重置</el-button>
      </div>
    </div>
  </div>
</template>
<script>
import { apiUrlConfig, save } from "@/api/cnaps/saps/clearAcctBalance/open_qry_entry.js";
import { listPageMixin } from "@/libs/listPageMixin";
import { log } from "util";

export default {
  name: "openQryEntry",
  mixins: [listPageMixin],
  components: {},
  data() {
    return {
      isforbid: false,
      isLoading: false,
      reqConfig: apiUrlConfig,
      //数据字典
      searchFormDictList: ["CLS_QUERYTYPE"],
      // 查询参数
      queryParams: {},
      formOptions: [],
      opButtonList: () => {
        return [];
      },
      tableBindColumns: [
        { label: `清算行号`, prop: "stBrno", sortable: false, align: "center" },
        {
          label: `清算行名`,
          prop: "stBrname",
          sortable: false,
          align: "center",
        },
      ],
      formData: {
        rspId: "",
        inqType: "",
        remarks: "",
      },
      rules: {
        inqType: [
          {
            required: true,
            message: "必填",
            trigger: "change",
          },
        ],
      },
    };
  },
  mounted() {},
  methods: {
    reset() {
      this.resetForm("entryForm");
      this.$set(this, "formData", {});
    },
    submitFn() {
      this.$refs["entryForm"].validate(valid => {
        if (valid) {
          this.isLoading = true;
          save({
            inqType: this.formData.inqType,
            remarks: this.formData.remarks,
          })
            .then(res => {
              this.isLoading = false;
              this.$set(this.formData, "rspId", res.result.rspId);
              this.isforbid = true;
              console.log(res, "提交成功！");
              this.msgSuccess("提交成功！");
            })
            .catch(err => {
              this.isLoading = false;
            });
        }
      });
    },
    resetFn() {
      if (this.formData.rspId) {
        this.$refs.dataTable.doQuery();
        this.isforbid = false;
      }
      this.reset();
    },
  },
};
</script>
<style lang="scss" scoped>
.bottom-control {
  margin: 30px 0;
  text-align: center;
}
</style>
